This invention relates to the field of computer systems. More particularly, a system and methods are provided for selecting and serving one of multiple versions of a set of data.
In traditional caching systems and methods, one version or copy of a set of data (e.g., a web page, web page component, database object) is typically cached and served in response to all requests for that data. Often, however, different requests may be better served with different versions of the data. The different versions may be in different languages, different protocols or formats (e.g., with frames or without frames), etc. For example, while a native speaker of a particular language may be able to fully enjoy a web page presented in that language, another user having a different native language may not be able to fully appreciate the same version of the web page.
Traditional cache systems generally look at just the data identifier (e.g., URL or Uniform Resource Locator) to identify the set of data to serve. If the cache system stores a set of data matching that identifier, it will serve it, even if a different version of the data is available and may be more responsive. More particularly, traditional cache systems cannot disambiguate a request for a multiversion data item to determine which version is most suitable for the request.
Thus, what is needed is a system and method for selecting and serving, from multiple versions of a set of data, a cached version that is most appropriate for a particular request.
In one embodiment of the invention a cache system and a method of serving one of multiple versions of a data item are provided. In this embodiment, a request for a data item (e.g., a web page, an object component of a web page, a collection of data) is received at a cache. An initial lookup is performed on the cache using a data identifier extracted from the request. The data identifier may identify the data item with a URL (Uniform Resource Locator), address, file name, etc.
If the initial lookup fails, a cache miss has occurred and the request may be forwarded to an origin server (e.g., web server, data server, application server) for handling. If the initial lookup is successful, it may return either the data item or, if disambiguation of the data request is necessary (i.e., to select one of multiple versions of the data item), a policy identifying additional information needed to select the most responsive of multiple versions of the data. The additional information is retrieved (e.g., from the request, the client, the origin server) and another lookup is performed using that information. If the lookup is successful, the data item is identified, retrieved from cache (if available) and served to the client.
In an embodiment of the invention, the extra information needed to disambiguate a request for a multi-version data item may include one or more cookies or parameters included in the request. Such parameters may identify a user agent (e.g., a browser), a version of a user agent, a country or language (e.g., of the client that submitted the request), etc. A disambiguation policy may be generated with an administrative interface configured to allow an administrator to identify a particular data item or set of data items (e.g., a specific jpeg image, all .html files in a given directory) and specify the additional information needed to select an appropriate version of the data item(s).